//
//  HEReportServerCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/25.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEReportServerCell.h"
#import "HEAddHealthReportViewController.h"

@interface HEReportServerCell ()

@property (nonatomic, strong) UILabel *titleLb;

@end

@implementation HEReportServerCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = CLightGrayColor;

        self.qmui_borderPosition = QMUIViewBorderPositionTop;
        self.qmui_borderWidth = 0.5;
        self.qmui_borderColor = CSplitLineColor;
     
        [self initUI];
    }
    return self;
}

- (void)initUI {
    
    UIView *warp = [UIView new];
    warp.backgroundColor = KWhiteColor;
    [self.contentView addSubview:warp];
    
    warp.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0];
    warp.layer.shadowColor = [UIColor colorWithRed:13/255.0 green:98/255.0 blue:218/255.0 alpha:0.08].CGColor;
    warp.layer.shadowOffset = CGSizeMake(0,5);
    warp.layer.shadowOpacity = 1;
    warp.layer.shadowRadius = 6;
    

    [warp mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(0);
        make.left.equalTo(self.contentView).mas_offset(0);
        make.right.equalTo(self.contentView).mas_offset(0);
        make.bottom.equalTo(self.contentView).mas_offset(-10);
    }];
    
    
    _titleLb = [UILabel new];
    _titleLb.text = @"报告解读服务";
    _titleLb.font = DYBlodFont(18);
    _titleLb.textColor = CNavLightBlackColor;
    [warp addSubview:_titleLb];
    
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(warp).mas_offset(15);
        make.left.equalTo(warp).mas_offset(15);
        make.right.equalTo(warp).mas_offset(-15);
    }];
    
    
    UIView *contentWarp = [UIView new];
    contentWarp.backgroundColor = CLightGrayColor;
    [warp addSubview:contentWarp];
    contentWarp.layer.masksToBounds = YES;
    contentWarp.layer.cornerRadius = 10;
    
    [contentWarp mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLb.mas_bottom).mas_offset(15);
        make.left.equalTo(warp).mas_offset(15);
        make.right.equalTo(warp).mas_offset(-15);
        make.bottom.equalTo(warp).mas_offset(-10);
    }];
    
    UIImageView *repView = [UIImageView new];
    repView.image = IMAGE_NAMED(@"guide_report");
    repView.contentMode = UIViewContentModeScaleAspectFill;
    [contentWarp addSubview:repView];
    
    [repView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(contentWarp);
        make.top.equalTo(contentWarp).mas_offset(15);
        make.width.height.mas_offset(45);
    }];
    
    QMUIGhostButton *addBtn = [[QMUIGhostButton alloc] initWithGhostColor:CNavBgColor];
    addBtn.titleLabel.font = UIFontMake(16);
    [addBtn setTitle:@"添加报告" forState:UIControlStateNormal];
    [contentWarp addSubview:addBtn];
    [addBtn addTarget:self action:@selector(addReporstClick) forControlEvents:UIControlEventTouchUpInside];
    
    [addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(contentWarp);
        make.top.equalTo(repView.mas_bottom).mas_offset(15);
        make.width.height.mas_offset(110);
        make.height.mas_offset(30);
        make.bottom.equalTo(contentWarp).mas_offset(-14);
    }];
}

- (void)addReporstClick {
    HEAddHealthReportViewController *vc = [HEAddHealthReportViewController new];
    vc.showSurplus = YES;
    [self.formModel.proxyVC.navigationController pushViewController:vc animated:YES];
}

- (void)refreshContent:(GDFiterCellModel *)fiterModel formModel:(GDFormModel *)formModel indexPath:(NSIndexPath *)indexPath {
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
